<template>
  <div class="goods" @click="goodsDetail" :style="styleData" :data-id="item.goods_id">
    <span class="discount" v-if="type==1"><img :src="pic01" alt=""></span>
    <div class="picture">
      <img v-lazy="{src:item.img640_url,loading:lazyPic}" alt="">
      <span class="pri" v-if="type==2"><img :src="pic02" alt=""></span>
    </div>
    <span class="abban" v-if="type==2"><img  :src="pic03" alt=""></span>
    <div class="price" v-if="type==2">￥{{item.flash_price}}</div>
  </div>
</template>

<script>
  export default {
    props:['parentData','styleData','type'],
    data(){
      return{
        item:{},
        lazyPic:require('../../../assets/img/publicImg/loading_default.png') ,
        pic01:require('../../../assets/img/fashionSummer/clsummer08.png'),
        pic02:require('../../../assets/img/fashionSummer/clsummer09.png'),
        pic03:require('../../../assets/img/fashionSummer/clsummer10.png'),
        showDiscount:true
      }
    },
    created(){
      this.item=this.parentData
     },
    methods:{
      goodsDetail(){
        this.$emit('childEvent',this.item.goods_id);
      }
    }
  }
</script>

<style lang="less" scoped>
.goods{
  width: 3.12rem;
  margin-right: 0.12rem;
  margin-bottom: 0.12rem;
  font-family: '微软雅黑';
  background: #fff;
  font-size: 0.3rem;
  box-sizing: border-box;
  position: relative;
  .discount{
    width: 0.65rem;
    font-size: 0.24rem;
    position: absolute;
    top: 0rem;right: 0.2rem;
    z-index: 5;
  }
  .picture{
    width: 100%;
    padding-top: 100%;
    position: relative;
    img{
      width: 100%;height: 100%;
      position: absolute;
      top: 0;left: 0;
    }
    .pri{
      width: 0.84rem;
      height: 0.84rem;
      position: absolute;
      bottom: 0.15rem;right: 0.15rem;
    }
  }
  .abban{
    width: 100%;height: 0.7rem;
    position: absolute;
    top: 0;left: 0;
  }
  .price{
    width: 0.8rem;
    height: 0.86rem;
    font-weight: 600;
    font-size: 0.26rem;
    padding-left: 0.06rem;
    line-height: 0.9rem;
    position: absolute;
    bottom: 0.15rem;
    right: 0.15rem;
    transform: rotate(-45deg);
  }
}
</style>